home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr42
/
vocshow2.zip
/
SB_SAMPL.LIB
< prev
next >
Wrap
Text File
|
1993-06-08
|
2KB
|
62 lines
-- Copyright 1992 by Tom Moran. May be used by anyone for any purpose.
package SB_Samples is
-- max DMA transfer block is limited to 64K by hardware and may be
-- further restricted by software, eg 386^MAX limits to 16K unless
-- you specifically tell it to allow bigger transfers (DMA= option)
-- so we'll make a safe maximum block length
Max_Block_Length:constant:=16383;
-- Unpacked and Packed (4 bits/sample) are the most used formats,
-- and indeed the only ones I understand. They are accordingly
-- given special names - not Packed1 and Packed2 as one might expect
-- for maximum consistency
subtype Sound_Indices is integer range 0 .. Max_Block_Length-1;
type Unpacked_Sound_Samples is range 0 .. 255;
for Unpacked_Sound_Samples'Size use 8;
type Unpacked_Sounds is array (Sound_Indices range <>)
of Unpacked_Sound_Samples;
-- Note: the 'correct' description of 4 bit packed data is:
--
-- type packed_sound_samples is record
-- sign : integer range 0 .. 1;
-- magnitude : integer range 0 .. 7;
-- end record;
-- for packed_sound_samples'size use 4;
-- for packed_sound_samples use record
-- sign at 0 range 3 .. 3; -- 4th bit from right
-- magnitude at 0 range 0 .. 2; -- rightmost 3 bits
-- end record;
--
-- type packed_sounds is array(integer range <>) of packed_sound_samples;
-- pragma pack(packed_sounds);
--
-- but the method that runs faster with my particular compiler is:
type Packed_Sound_Nibbles is range 0 .. 15;
for Packed_Sound_Nibbles'Size use 4;
type Packed_Sound_Pairs is range 0 .. 255;
for Packed_Sound_Pairs'Size use 8;
type Packed_Sounds is array (Sound_Indices range <>)
of Packed_Sound_Pairs;
type Packed_Sound_Triples is range 0 .. 255;
for Packed_Sound_Triples'Size use 8;
type Packed3_Sounds is array (Sound_Indices range <>)
of Packed_Sound_Triples;
type Packed_Sound_Quadruples is range 0 .. 255;
for Packed_Sound_Quadruples'Size use 8;
type Packed4_Sounds is array (Sound_Indices range <>)
of Packed_Sound_Quadruples;
end SB_Samples;